import { post, get, put } from '../utils/request';

/**
 * 个人中心相关API
 */

// 获取个人信息
export const getPersonalInfo = () => {
  return get('/v1/personal/info');
};

// 更新个人信息
export const updatePersonalInfo = (data: {
  name?: string;
  phone?: string;
  email?: string;
  avatar?: string;
  description?: string;
}) => {
  return put('/v1/personal/info', data);
};

// 修改密码
export const changePassword = (data: {
  oldPassword: string;
  newPassword: string;
  confirmPassword: string;
}) => {
  return post('/v1/personal/change-password', data);
};

// 获取操作日志
export const getOperationLogs = (params?: {
  page?: number;
  pageSize?: number;
  startDate?: string;
  endDate?: string;
}) => {
  return get('/v1/personal/operation-logs', params);
};

// 获取系统通知
export const getNotifications = (params?: {
  page?: number;
  pageSize?: number;
  status?: string;
}) => {
  return get('/v1/personal/notifications', params);
};

// 标记通知为已读
export const markNotificationRead = (id: string) => {
  return put(`/v1/personal/notifications/${id}/read`);
};

// 获取个人统计数据
export const getPersonalStats = () => {
  return get('/v1/personal/stats');
};
